package com.neusoft.liduan.d0911.zi;

import javax.swing.JFrame;

//在MyFrame窗口中设置标题等属性
public class OtherFrame extends JFrame{
	public JFrame myFrame;//限制了类型必须是MyFrame
	
	public OtherFrame(JFrame myFrame) {
		this.myFrame = myFrame;
	}
	
	public void doSomething() {
		this.myFrame.setTitle("设置的新标题");
	}
	
	public static void main(String[] args) {
		MyFrame mf = new MyFrame();
		OtherFrame of = new OtherFrame(mf);
		OtherFrame of1 = new OtherFrame(of);
		//OtherFrame创建对象时只要是JFrame的子类都可以
	}
}
